package demo12.mytest;

import java.io.IOException;
import java.io.InputStream;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import demo12.model.Customer;

public class MybatisTest {

	public static void main(String[] args) throws IOException {
		String path="mybatis-config.xml";
		InputStream istream =Resources.getResourceAsStream(path);
		SqlSessionFactory factory  =new SqlSessionFactoryBuilder().build(istream);
		SqlSession sqlsession = factory.openSession();
		Customer c =sqlsession.selectOne(
				"demo12.dao.impl.CustomerMapper.getCustomerById", 1);
		System.out.println(c.toString());
		sqlsession.close();

	}

}
